//
//  BTEditVCardViewController.m
//  WeChat
//
//  Created by 互联网 on 16/11/3.
//  Copyright © 2016年 bigtree. All rights reserved.
//

#import "BTEditVCardViewController.h"

@interface BTEditVCardViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textFiled;

@end

@implementation BTEditVCardViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = self.cell.textLabel.text;
    self.textFiled.text = self.cell.detailTextLabel.text;
}

- (IBAction)saveBtnClick:(id)sender {
    // 1. 重新设置cell的值
    self.cell.detailTextLabel.text = self.textFiled.text;
    
    /**
     *  初始时没有数据，修改数据后延缓加载，解决方式
     [self.view layoutSubviews];
     */
    
    // 2.当前控制器销毁
    [self.navigationController popViewControllerAnimated:YES];
    
    // 3.将数据保存到电子名片，上传到服务器
    if ([_delegate respondsToSelector:@selector(editVCardViewController:didFinishSave:)]) {
        [_delegate editVCardViewController:self didFinishSave:sender];
    }
}
@end
